﻿using System;
using System.Linq;
using System.Windows.Forms;
using eAtlantida.Tools.Generator;
using eAtlantida.Tools.Generator.Sql;

namespace GeneratorDemo
{
    public partial class Form1 : Form
    {
        private const string connectionString = @"data source=wd-server-3\sql2k12;initial catalog=myLibrary;user id=o.maslovsky;password=o.maslovsky;MultipleActiveResultSets=True;";
        private readonly Discover _discover;

        public Form1()
        {
            InitializeComponent();
            _discover = new Discover(connectionString);
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            var columns = _discover.GetColumns("Comments").ToList();

            var serverGenerator = new ServerGenerator(columns, "Comments");
            var result = serverGenerator.GenerateController();

            textBox1.Text = result;
        }
    }
}
